package com.system.outpatientsystem.mapper;

import com.system.outpatientsystem.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper {

    @Select("select * from user where id = #{id}")
    User findById(Integer id);

    //添加用户
    @Insert("INSERT INTO user(id,name, age, gender, phone, password)" +
            " VALUES (#{id},#{name}, #{age}, #{gender}, #{phone}, #{password})")
    void add(User user);

    @Select("select * from user where phone = #{phone}")
    User findByPhone(String phone);

    //更新用户信息
    @Update("update user set name=#{name},age=#{age},gender=#{gender} where phone = #{phone}")
    void userUpdate(User user);

    @Update("update user set password = #{md5Upper} where phone = #{phone}")
    void userUpdatePwd(String md5Upper, String phone);
}
